<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改实有房屋登记信息')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="white-bg" onload="gradeChange()">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-info">
                <div class="panel-heading">
                    <i class="fa fa-info-circle"></i> 实有房屋
                </div>
                <div class="panel-body">
                    <form class="form-horizontal m" id="form-house-edit" th:object="${house}">
                        <input name="ywlsh" th:field="*{ywlsh}" type="hidden">
                        <div class="form-group">
                            <label class="col-sm-3 control-label is-required">地址名称：</label>
                            <div class="col-sm-8">
                                <input name="dzmc" th:field="*{dzmc}" class="form-control" type="text" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">使用形式：</label>
                            <div class="col-sm-8">
                                <select name="syxs" class="form-control m-b"
                                        th:with="type=${@dict.getParamValue('SQJW_SYXS')}">
                                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                            th:value="${dict.itemValue}"
                                            th:field="*{syxs}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label is-required">房屋用途：</label>
                            <div class="col-sm-8">
                                <select name="fwytdm" class="form-control m-b"
                                        th:with="type=${@dict.getParamValue('SQJW_FWYT')}"
                                        required>
                                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                            th:value="${dict.itemValue}"
                                            th:field="*{fwytdm}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label is-required">房屋类别：</label>
                            <div class="col-sm-8">
                                <select name="fwlbdm" class="form-control m-b"
                                        th:with="type=${@dict.getParamValue('SQJW_FWLB')}"
                                        required>
                                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                            th:value="${dict.itemValue}"
                                            th:field="*{fwlbdm}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label is-required">房屋性质：</label>
                            <div class="col-sm-8">
                                <select name="fwcqxzzldm" class="form-control m-b"
                                        th:with="type=${@dict.getParamValue('SQJW_FWXZ')}" required>
                                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                            th:value="${dict.itemValue}"
                                            th:field="*{fwcqxzzldm}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">房屋间数：</label>
                            <div class="col-sm-8">
                                <input name="fwjs" th:field="*{fwjs}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">房屋面积：</label>
                            <div class="col-sm-8">
                                <input name="fwmjMjpfm" th:field="*{fwmjMjpfm}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">房屋产权证号：</label>
                            <div class="col-sm-8">
                                <input name="fwcqzh" th:field="*{fwcqzh}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">房主公民身份号码：</label>
                            <div class="col-sm-8">
                                <input name="fzGmsfhm" th:field="*{fzGmsfhm}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">房主姓名：</label>
                            <div class="col-sm-8">
                                <input name="fzXm" th:field="*{fzXm}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">房主证件种类：</label>
                            <div class="col-sm-8">
                                <select name="fzCyzjdm" class="form-control m-b"
                                        th:with="type=${@dict.getParamValue('SQJW_ZJZL2')}">
                                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                            th:value="${dict.itemValue}"
                                            th:field="*{fzCyzjdm}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">房主证件号码：</label>
                            <div class="col-sm-8">
                                <input name="fzZjhm" th:field="*{fzZjhm}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">房主外文姓：</label>
                            <div class="col-sm-8">
                                <input name="fzWwx" th:field="*{fzWwx}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">房主外文名：</label>
                            <div class="col-sm-8">
                                <input name="fzWwm" th:field="*{fzWwm}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">房主联系电话：</label>
                            <div class="col-sm-8">
                                <input name="fzLxdh" th:field="*{fzLxdh}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">托管人公民身份号码：</label>
                            <div class="col-sm-8">
                                <input name="tgrGmsfhm" th:field="*{tgrGmsfhm}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">托管人姓名：</label>
                            <div class="col-sm-8">
                                <input name="tgrXm" th:field="*{tgrXm}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">托管人证件种类：</label>
                            <div class="col-sm-8">
                                <select name="tgrCyzjdm" class="form-control m-b"
                                        th:with="type=${@dict.getParamValue('SQJW_ZJZL2')}">
                                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                            th:value="${dict.itemValue}"
                                            th:field="*{tgrCyzjdm}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">托管人证件号码：</label>
                            <div class="col-sm-8">
                                <input name="tgrZjhm" th:field="*{tgrZjhm}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">托管人外文姓：</label>
                            <div class="col-sm-8">
                                <input name="tgrWwx" th:field="*{tgrWwx}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">托管人外文名：</label>
                            <div class="col-sm-8">
                                <input name="tgrWwm" th:field="*{tgrWwm}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">托管人联系电话：</label>
                            <div class="col-sm-8">
                                <input name="tgrLxdh" th:field="*{tgrLxdh}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">与房主关系：</label>
                            <div class="col-sm-8">
                                <select name="tgrYfzgxRygxdm" class="form-control m-b"
                                        th:with="type=${@dict.getParamValue('T_PEO_RELATION')}">
                                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                            th:value="${dict.itemValue}"
                                            th:field="*{tgrYfzgxRygxdm}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">登记人账号：</label>
                            <div class="col-sm-8">
                                <input name="djrZh" th:field="*{djrZh}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label is-required">登记人姓名：</label>
                            <div class="col-sm-8">
                                <input name="djrXm" th:field="*{djrXm}" class="form-control" type="text" required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">登记时间：</label>
                            <div class="col-sm-8">
                                <div class="input-group date">
                                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                    <input name="djsj" th:value="${#dates.format(house.djsj, 'yyyy-MM-dd')}"
                                           class="form-control"
                                           placeholder="yyyy-MM-dd" type="text" required>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">更新账户：</label>
                            <div class="col-sm-8">
                                <input name="gxrZh" th:field="*{gxrZh}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">更新部门：</label>
                            <div class="col-sm-8">
                                <input name="gxbm" th:field="*{gxbm}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">核录部门：</label>
                            <div class="col-sm-8">
                                <input name="hlbm" th:field="*{hlbm}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">核录时间：</label>
                            <div class="col-sm-8">
                                <div class="input-group date">
                                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                    <input name="hlsj" th:value="${#dates.format(house.hlsj, 'yyyy-MM-dd')}"
                                           class="form-control"
                                           placeholder="yyyy-MM-dd" type="text">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">核录人：</label>
                            <div class="col-sm-8">
                                <input name="hlr" th:field="*{hlr}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">核录标识：</label>
                            <div class="col-sm-8">
                                <select name="hlbz" class="form-control m-b"
                                        th:with="type=${@dict.getParamValue('YBSS_HLBZ')}">
                                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                            th:value="${dict.itemValue}"
                                            th:field="*{hlbz}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">中心点横坐标：</label>
                            <div class="col-sm-8">
                                <input name="zxdhzb" th:field="*{zxdhzb}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">中心点纵坐标：</label>
                            <div class="col-sm-8">
                                <input name="zxdzzb" th:field="*{zxdzzb}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">标签：</label>
                            <div class="col-sm-8">
                                <input name="bq" th:value="${bq}" type="hidden">
                                <input id="labelName" th:value="${labelNames}" class="form-control" type="text"
                                       readonly>
                                <div id="tree" class="ztree" style="border: 1px solid #e5e6e7"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">互联网审核人：</label>
                            <div class="col-sm-8">
                                <input name="hlwshr" th:field="*{hlwshr}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">互联网审核时间：</label>
                            <div class="col-sm-8">
                                <div class="input-group date">
                                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                    <input name="hlwshsj" th:value="${#dates.format(house.hlwshsj, 'yyyy-MM-dd')}"
                                           class="form-control" placeholder="yyyy-MM-dd" type="text">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">注销时间：</label>
                            <div class="col-sm-8">
                                <div class="input-group date">
                                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                    <input name="zxsj" th:value="${#dates.format(house.zxsj, 'yyyy-MM-dd')}"
                                           class="form-control"
                                           placeholder="yyyy-MM-dd" type="text">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">注销账号：</label>
                            <div class="col-sm-8">
                                <input name="zxzh" th:field="*{zxzh}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">审批人：</label>
                            <div class="col-sm-8">
                                <input name="spr" th:field="*{spr}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">审批时间：</label>
                            <div class="col-sm-8">
                                <div class="input-group date">
                                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                    <input name="spsj" th:value="${#dates.format(house.spsj, 'yyyy-MM-dd')}"
                                           class="form-control"
                                           placeholder="yyyy-MM-dd" type="text">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">注销原因：</label>
                            <div class="col-sm-8">
                                <input name="zxyy" th:field="*{zxyy}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">是否重点：</label>
                            <div class="col-sm-8">
                                <select name="sfzd" class="form-control m-b"
                                        th:with="type=${@dict.getParamValue('SFZD_DQJC')}">
                                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                            th:value="${dict.itemValue}"
                                            th:field="*{sfzd}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">是否定期检查：</label>
                            <div class="col-sm-8">
                                <select id="dqjc" name="sfdqjc" onchange="gradeChange()" class="form-control m-b"
                                        th:with="type=${@dict.getParamValue('SFZD_DQJC')}">
                                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                                            th:value="${dict.itemValue}"
                                            th:field="*{sfdqjc}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group" id="szjczq" style="visibility:hidden">
                            <label class="col-sm-3 control-label">检查周期（天）：</label>
                            <div class="col-sm-8">
                                <input name="jczq" th:field="*{jczq}" class="form-control" type="number"
                                       oninput="value=value.replace(/[^\d]/g,'')">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-info">
                <div class="panel-heading">
                    <i class="fa fa-info-circle"></i> 实有人口
                </div>
                <div class="panel-body">
                    <div th:if="${populations} ne null" th:each="population : ${populations}" class="col-sm-4">
                        <div class="panel panel-primary">
                            <div class="panel-heading" th:text="${population.xm}"></div>
                            <div class="panel-body">
                                <div style="text-align: center;overflow: hidden;">
                                    <img th:src="(${population.photo} == null) ? @{/res/img/profile.jpg} : '/sys/common/view/' + @{${population.photo}}"
                                         style="height: 175px; width: auto;" alt="Population Image">
                                </div>

                                <!--<p>头像：[[${population.photo}]]</p>
                                <p>身份号码：[[${population.gmsfhm}]]</p>
                                <p>出生日期：[[${#dates.format(population.csrq, 'yyyy-MM-dd')}]]</p>
                                <p>户籍地：[[${#strings.defaultString(population.hjd, '-')}]]</p>
                                <p>标签：[[${#strings.defaultString(population.bq, '-')}]]</p>-->
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4" style="padding-top: 25px;">
                        <div class="panel panel-primary">
                            <!--						<div class="panel-heading" th:text="添加"></div>-->
                            <div class="panel-body">
                                <div style="text-align: center;" onclick="addPopulation()">
                                    <img th:src="@{/res/img/add-plus.png}" style="height: 175px; width: auto;"
                                         alt="add Image">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: datetimepicker-js"/>
<script type="text/javascript">
    var prefix = ctx + "control/house";
    $("#form-house-edit").validate({
        focusCleanup: true
    });

    function gradeChange() {
        var $sfdqjc = $('#dqjc option:selected');
        if ($sfdqjc.val() == "Y") {
            document.getElementById("szjczq").style.visibility = "visible";
        } else {
            document.getElementById("szjczq").style.visibility = "hidden";
        }
    }

    $(function () {
        var url = ctx + "control/label/treeData";
        var options = {
            id: "tree",
            url: url,
            check: {enable: true},
            expandLevel: 0,
            onCheck: onCheck
        };
        $.tree.init(options);
    });

    function onCheck() {
        $('input[name="bq"]').val(getChecked('id'));
        $('#labelName').val(getChecked('name'));
    }

    function getChecked(column) {
        var nodes = $._tree.getCheckedNodes(true);
        return $.map(nodes, function (row) {
            if (!row.isParent) {
                return row[column]
            }
        }).join();
    }

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-house-edit').serialize());
        }
    }

    $("input[name='djsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true,
        type: "datetime"
    });

    $("input[name='gxsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='hlsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='hlwshsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='inTime']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='zxsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='spsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
<script th:inline="javascript">
    function addPopulation() {
        $.modal.open("添加实有人口", $.common.setURL("/control/population/add/" + [[${house.ywlsh}]]));
    }
</script>
</body>
</html>
